using System;
using System.IO;

namespace testAPP
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("{0}:{1}.{2}", DateTime.Now.Minute, DateTime.Now.Second, DateTime.Now.Millisecond);
            MYMain(Commands.encode, @"C:\heaviez.lin.xml", @"C:\s.xml.7z");
            Console.WriteLine("{0}:{1}.{2}", DateTime.Now.Minute, DateTime.Now.Second, DateTime.Now.Millisecond);
            MYMain(Commands.decode, @"C:\s.xml.7z", @"C:\s2.xml");
            Console.ReadLine();
        }

        enum Commands
        {
            encode = 0,
            decode = 1
        }

        static int MYMain(Commands command, string inFile, string outFile)
        {
            Console.WriteLine("\nLZMA# 4.61  2008-11-23\n");

            byte[] bytes = File.ReadAllBytes(inFile);

            MemoryStream inStream = new MemoryStream(bytes);
            string outputName = outFile;

            MemoryStream outStream = new MemoryStream();

            switch (command)
            {
                case Commands.encode: IgorPavlov.SevenZip.LZMACompression.Compress(inStream, outStream); break;
                case Commands.decode: IgorPavlov.SevenZip.LZMACompression.Deflate(inStream, outStream); break;
            }

            File.WriteAllBytes(outFile, outStream.ToArray());

            return 0;
        }

    }
}
